import java.util.Scanner;

public class demo7 {
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        System.out.println("请输入n的值:");
        int n= scanner.nextInt();
        System.out.println(f(n));
    }
    public static int f(int n){
        int s1=1;
        int sum1=0;
        int sum2=0;
        for (int i = 1; i <= n; i++) {
            sum2=0;
            for (int j = 1; j <=i ; j++) {
                s1=1;
                for (int k = 1; k <=j ; k++) {
                    s1=s1*k;
                }
                sum1=sum1+s1;
            }
            sum2=sum2+sum1;
        }
        return  sum2;
    }
}
